package org.jod.anarchytrek.componentfactory;

import java.util.HashMap;
import java.util.Map;

import org.jod.anarchytrek.AComponent;
import org.jod.anarchytrek.component.Eps;
import org.jod.anarchytrek.component.WarpDrive;
import org.jod.anarchytrek.info.EpsInfo;
import org.jod.anarchytrek.info.WarpDriveInfo;

public class WarpDriveFactory extends AComponentFactory {

    private Map _mapClass;

    private String _warpDriveType;

    private Map _components;

    private Map _infoComponents;

    public WarpDriveFactory(Map aInfoComponents, Map aComponents, String aWarpDriveType) {

        _infoComponents = aInfoComponents;
        _components = aComponents;
        _warpDriveType = aWarpDriveType;

        _mapClass = new HashMap();
        WarpDriveClass warpDriveClass = null;

        warpDriveClass = new WarpDriveClass();
        warpDriveClass.name("1A");
        warpDriveClass.maximumEnergyPoint(99);
        warpDriveClass.minimunEnergyPoint(10);
        warpDriveClass.structuralUnits(20);
        _mapClass.put("1A", warpDriveClass);

        warpDriveClass = new WarpDriveClass();
        warpDriveClass.name("2B");
        warpDriveClass.maximumEnergyPoint(149);
        warpDriveClass.minimunEnergyPoint(100);
        warpDriveClass.structuralUnits(30);
        _mapClass.put("2B", warpDriveClass);

        warpDriveClass = new WarpDriveClass();
        warpDriveClass.name("3E");
        warpDriveClass.maximumEnergyPoint(199);
        warpDriveClass.minimunEnergyPoint(150);
        warpDriveClass.structuralUnits(40);
        _mapClass.put("3E", warpDriveClass);

        warpDriveClass = new WarpDriveClass();
        warpDriveClass.name("4G");
        warpDriveClass.maximumEnergyPoint(249);
        warpDriveClass.minimunEnergyPoint(200);
        warpDriveClass.structuralUnits(50);
        _mapClass.put("3E", warpDriveClass);

        warpDriveClass = new WarpDriveClass();
        warpDriveClass.name("5H");
        warpDriveClass.maximumEnergyPoint(299);
        warpDriveClass.minimunEnergyPoint(250);
        warpDriveClass.structuralUnits(60);
        _mapClass.put("5H", warpDriveClass);
    }

    public void build() {
        WarpDriveInfo warpDriveInfo = new WarpDriveInfo();
        _infoComponents.put(AComponent.WARPDRIVE, warpDriveInfo);
        WarpDriveClass aClass = (WarpDriveClass)_mapClass.get(_warpDriveType);
        _components.put(AComponent.WARPDRIVE, new WarpDrive(warpDriveInfo, aClass));
        
    }

}
